package com.relife.core.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import com.relife.common.utils.StringUtil;
import org.hibernate.annotations.GenericGenerator;


/**
 * 实体基类
 * 
 * @author Administrator
 * 
 */
@MappedSuperclass
public class BaseEntity implements Serializable {
	private static final long serialVersionUID = 3477089705167049022L;
	private String id;
	/** 创建时间 **/
	private Date createDate;
	/** 最后一次修改时间 **/
	private Date updateDate;
	/** 修改人 **/
	private String editor;
	/** 创建人 **/
	private String creator;

	/** 权限过滤 **/
	private String depCode;
	private String userCode;

	public BaseEntity() {
	}

	@Id
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Column(name = "id", unique = true, nullable = false, length = 32)
	public String getId() {
		return StringUtil.isEmpty(id) ? null : id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(updatable = false)
	public Date getCreateDate() {
		return createDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public String getEditor() {
		return editor;
	}

	public void setEditor(String editor) {
		this.editor = editor;
	}

	@Column(updatable = false)
	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	@Column(name = "depCode", length = 32)
	public String getDepCode() {
		return depCode;
	}

	public void setDepCode(String depCode) {
		this.depCode = depCode;
	}

	@Column(name = "userCode", length = 32)
	public String getUserCode() {
		return userCode;
	}

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}
}
